﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="../../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <!-- 引用通用的js文件. -->
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <link href="../../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
    <script src="../../Scripts/layui/layui/layui.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
        var laybase = "../../";
        //页面启动函数.
        $(function () {

            var nodeID = GetQueryString("NodeID");

            var en = new Entity("BP.WF.Template.NodeExt", nodeID);
            var doc = en.DoMethodReturnString("ReadHelpAlert");
            $("#RichText").val(doc);
            //显示富文本框
            var images_upload_url = "";
            var handlerUrl = "";
            if (plant == "CCFlow")
                handlerUrl = basePath + "/WF/Comm/Handler.ashx";
            else
                handlerUrl = basePath + "/WF/Comm/Sys/ProcessRequest.do";

            images_upload_url = handlerUrl + '?DoType=HttpHandler&DoMethod=RichUploadFile';
            images_upload_url += '&HttpHandlerName=BP.WF.HttpHandler.WF_Comm_Sys&FrmID=' + nodeID + "&WorkID=0";
            layui.extend({
                tinymce: '../../Scripts/layui/ext/tinymce/tinymce'
            }).use('tinymce', function () {
                var tinymce = layui.tinymce;
                var h = $("#RichText").height();
                //if (h < 400) h = 400;
                tinymce.render({
                    elem: "#RichText"
                    , height: h
                    , images_upload_url: images_upload_url
                    , paste_data_images: true
                    //取消默认提示

                });

            });

        });
        function Save() {

            var nodeID = GetQueryString("NodeID");
            var edit = layui.tinymce.get("#RichText");
            var val = edit.getContent();
            //获取富文本的内容
            if (val == "") {
                alert("内容不能为空！");
                return;
            }
            var en = new Entity("BP.WF.Template.NodeExt", nodeID);
            //执行保存富文本的内容
            var msg = en.DoMethodReturnString("SaveHelpAlert", val);

            alert(msg);
            Reload();

        }
    </script>
</head>
<body>


    <div style='white-space:normal;margin:8px'>
        <h3> 编辑帮助信息 </h3>
        <textarea style="height:calc(100vh - 100px);width:100%;" id="RichText"></textarea>
    </div>
    <br />
    <button type="button" class="layui-btn layui-btn-primary" onclick="Save();">确定</button>
</body>
</html>